package sdk.org.apache.shiro.G2_使用.C05_认证_1策略选择;

import org.apache.shiro.authc.UnknownAccountException;

import com.titan.core.utils.debug.Timer;

import sdk.org.apache.shiro.utils.ShiroUtils;

public class 使用策略AllSuccessfulStrategy_验证失败 {
    public static void main(String[] args) {
        Timer timer = Timer.$();
        try {
            run(timer);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            timer.print("执行总用时");
            System.exit(0);
        }
    }
    
    
    private static void run(Timer timer) throws Exception {
        ShiroUtils.init(new org.apache.shiro.authc.pam.AllSuccessfulStrategy()
                , new org.apache.shiro.authz.permission.WildcardPermissionResolver()
                , new sdk.org.apache.shiro.G2_使用.C05_认证_1策略选择.realm.Realm_1认证zhang()
                , new sdk.org.apache.shiro.G2_使用.C05_认证_1策略选择.realm.Realm_2认证wang()
                );
        try {
            ShiroUtils.login("zhang", "123", true);
            ShiroUtils.print();
        } catch (UnknownAccountException e) {
            System.err.println(e.toString());
        } finally {
            ShiroUtils.logout();
        }
    }
    

}
